<?php
if (!class_exists('TCPDF')) 
{
	require_once(CAKE.'Clases/tcpdf/tcpdf.php');
}
class Cierre extends TCPDF
{
	var $xheadertext = 'PDF created using CakePHP and TCPDF' ;
	var $xheadercolor = null;//;array( 0 , 0 , 200 );
	var $xfootertext = 'Copyright © %d XXXXXXXXXXX. All rights reserved.' ;
	var $xfooterfont = '';//PDF_FONT_NAME_MAIN;
	var $xfooterfontsize = 7 ;
	var $impresopor = 'Usuario: NO DEFINIDO';
	var $copy = 'Copyright © %d . Todos los derechos reservados.';
	var $sistema ='';
	var $desde;
	var $hasta;
	function setDesde($d){$this->desde=$de;} function getDesde(){ return $this->desde;}
	function setHasta($h){$this->hasta=$h;} function getHasta(){ return $this->hasta;} 
	function mayus($let) { return strtr(strtoupper($let),"àèìòùáéíóúçñäëïöü","ÀÈÌÒÙÁÉÍÓÚÇÑÄËÏÖÜ");}
	function Header ()
	{
			if($this->CurOrientation=='P') $this->Image(K_PATH_IMAGES.'agropatria.png',155,5,'41','17');
			else $this->Image(K_PATH_IMAGES.'agropatria.png',220,5,'41','17');
			$this->Image(K_PATH_IMAGES.'gobierno.jpeg',10,6,'30','17');
			$this->SetMargins(100, 70,200);
			$html='<table width="700px" border="0" cellpadding="0" cellspacing="0">
						<tr>
								<td  align="left" colspan="2">EMPRESA DE PROPIEDAD SOCIAL AGROPATRIA, S. A</td>
								<td></td>
						</tr>
						<tr>
								<td align="left">RIF: G200102144</td>
								<td align="left">CIERRE DE CAJA ACARIGUA</td>
								<td></td>
						</tr>
						<tr>
								<td align="left">TELEFONO: 0244-4479955</td>
								<td align="left">POR CAJERO AMENDOZA LKJLKJ</td>
								<td></td>
						</tr>
						<tr>
								<td align="left" style="font-size:22px;">Fecha de Cierre: '.$this->getDesde().'</td>
								<td></td>
								<td align="left" style="font-size:22px;">Fecha de Cierre: '.$this->getHasta().'</td>
						</tr>
						</table>';
			$this->writeHTMLCell('', '', 17, 25, $html, 0, 0, 0, true, 'C');
	}

	function Footer()
	{
			$year = date ( 'Y' );
			$footertext = sprintf ( $this -> xfootertext , $year );
			$this -> SetY (- 15 );
			$this -> SetTextColor ( 0 , 0 , 0 );
			$this -> SetFont ( $this -> xfooterfont , '' , $this -> xfooterfontsize );
			$this -> Cell ( 0 , 0 , $footertext , 'T' , 1 , 'L' );
			$impresopor = $this -> impresopor;
			$this -> Cell ( 0 , 0 , $impresopor , '' , 1 , 'R' );

			$sist = $this -> sistema." ".sprintf ( $this -> copy , $year );
			$this -> SetFont ( $this -> xfooterfont , '' , 5 );
			$this -> Cell ( 0 , 2 , $sist, '' , 1 , 'L' );
			$fechad = date('d-m-Y h:i:s a');
			$this -> SetFont ( $this -> xfooterfont , '' , 9 );
			$this->writeHTMLCell('', '', '8', '270', $fechad, 0, 0, 0, true, 'C');
			
			$this->setFooterMargin(0);
			$this->SetY(-15);
			$this->SetFont('helvetica', 'I', 8);
			$this->Cell(0, 10, 'Página '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, 0, 'C');	
	}
}
?>
